/**
 * 
 */
package com.zxc.fastjson;

import java.util.Arrays;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;

/**
 * @author Administrator
 *
 */
public class FastJsonDemo {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		UserDemo u1 =new UserDemo();
		u1.setName("u1");
		
		UserDemo u2 =new UserDemo();
		u2.setName("u2");
		
		UserDemo u3 =new UserDemo();
		u3.setName("u3");
		
		u1.setSubUsers(Arrays.asList(u2,u3));
		
		System.out.println(JSON.toJSONString(u1));
		String json = JSON.toJSONString(u1);
		
		UserDemo2 u4 = JSONObject.parseObject(json, UserDemo2.class);
		System.out.println(JSON.toJSONString(u4));
		
		String s = "{\"status\":0,\"airbookstatus\":\"E\",\"demo\":\"价格校验处理发生异常！获取PNR失败，原因：Invalid or Expired binary security token: Shared/IDL:IceSess\\/SessMgr:1\\.0.IDL/Common/!ICESMS\\/RESB!ICESMSLB\\/RES.LB!1709446967063!8826!517，详情：soap-env:Client.InvalidSecurityTokenInvalid or Expired binary security token: Shared/IDL:IceSess\\/SessMgr:1\\.0.IDL/Common/!ICESMS\\/RESB!ICESMSLB\\/RES.LB!1709446967063!8826!517com.sabre.universalservices.base.session.SessionException: errors.session.USG_INVALID_SECURITY_TOKEN\",\"basestr\":\"\"}";
		System.out.println(JSON.parse(s));
	}

}
